﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using UPNPLib;

namespace CameraPlayer
{
    public partial class FormCool : Form
    {
        public FormCool()
        {
            InitializeComponent();
        }
        public delegate void CallBack(UPnPDevice device, string udn, uint i);
        private void buttonLoad_Click(object sender, EventArgs e)
        {
            List<Device> devices = new List<Device>();
            Device nadeemPhone = new Device(){ 
                Name="Nadeed's Phone", 
                UniqueId= Guid.NewGuid().ToString()
            };
            devices.Add(nadeemPhone);
            comboBoxDevices.DisplayMember = "Name";
            comboBoxDevices.DataSource    = devices; 
           
            //======xxxxxxx===============xxxxxxxxxxxxx====>
            //===================>========Console.ReadLine();
            //===================>Console.WriteLine("Done.");
           //var  mdDiscovery =  Discovery(msSearchUri, maffAddressFamilyFlags, mbResolveNetworkInterface);
        }
        public static void upnpcallback(UPnPDevice device, string udn, uint i)
        {
            Console.WriteLine("upnpcallback!");
            switch (i)
            {
                case 0: //device added
                    Console.WriteLine("Device added: {0}", device.FriendlyName);
                    break;
                case 1: // device removed
                    Console.WriteLine("Device removed: {0}", udn);
                    break;
                case 2: // search completed
                    Console.WriteLine("Search Completed");
                    break;
                default:
                    Console.WriteLine("Default");
                    break;
            }
        }

        private void buttonPlay_Click(object sender, EventArgs e)
        {

        }

        private void buttonClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
    public class Device
    {
        string name;

        public string Name
        {
            get { return name; }
            set { name = value; }
        }
        string uniqueId;

        public string UniqueId
        {
            get { return uniqueId; }
            set { uniqueId = value; }
        }
    }
}
